//
//  SettingViewController.m
//  clublbiza
//
//  Created by WANG TOM on 8/8/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "SettingViewController.h"
#import "SLFoundation.h"
#import "ApiLogin.h"



@interface SettingViewController ()

@end

@implementation SettingViewController
@synthesize controllerOpener;
@synthesize mainView;
@synthesize setSyncView,setBackgroundView;
@synthesize setSyncViewVC,setBackgroundViewVC;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    
    self.setSyncViewVC = [[SettingSYNCViewController alloc] init];
    self.setSyncView =  self.setSyncViewVC.view;
    CGRect frame = self.mainView.frame;
    frame.origin.x = 0;
    frame.origin.y = 0;
    self.setSyncView.frame = frame;
    [self.mainView addSubview: self.setSyncView];
    
    self.setBackgroundViewVC = [[SettingBackgroundViewController alloc] init];
    self.setBackgroundView = self.setBackgroundViewVC.view;
    frame = self.mainView.frame;
    frame.origin.x = 0;
    frame.origin.y = 0;
    self.setBackgroundView .frame = frame;
    [self.mainView addSubview:self.setBackgroundView];
    
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    [self.setSyncViewVC release];
    [self.setBackgroundViewVC release];
    
    [self.setSyncView release];
    [self.setBackgroundView release];
    self.mainView = nil;
  
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
	  return interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight;
}

- (IBAction)backButtonClick:(id)sender
{
    [self.controllerOpener settingCallback];
 
 
}

-(IBAction)segmentSelected:(id)sender
{
    UISegmentedControl* control = (UISegmentedControl*)sender;  
    switch (control.selectedSegmentIndex) {  
        case 0:
           [self.mainView bringSubviewToFront:self.setBackgroundView];
            break;
        case 1:
            
             [self.mainView bringSubviewToFront:self.setSyncView];
            break;
    }
}
@end
